#ifndef ERRORSTREAM_H
#define ERRORSTREAM_H
#ifdef WIN32
#define NOMINMAX
#include <windows.h>
#endif

#include <stdio.h>

class ErrorStream : public NxUserOutputStream
{

	public:

	void reportError(NxErrorCode e, const char* message, const char* file, int line)
	{

		printf("%s (%d) :", file, line);
		switch (e)
		{
			case NXE_INVALID_PARAMETER:
				printf( "invalid parameter");
				break;
			case NXE_INVALID_OPERATION:
				printf( "invalid operation");
				break;
			case NXE_OUT_OF_MEMORY:
				printf( "out of memory");
				break;
			case NXE_DB_INFO:
				printf( "info");
				break;
			case NXE_DB_WARNING:
				printf( "warning");
				break;
			default:
				printf("unknown error");
		}

		printf(" : %s\n", message);
	}

	NxAssertResponse reportAssertViolation(const char* message, const char* file, int line)
	{
		printf("access violation : %s (%s line %d)\n", message, file, line);
		assert(0);

		return NX_AR_CONTINUE;
	}

	void print(const char* message)
	{
		printf(message);
	}
};

#endif